package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Comment;
import cn.tedu._04mybatis.vo.CommentVo1;
import cn.tedu._04mybatis.vo.CommentVo2;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author Justin Parker
 * @Date 2024/8/5 0005 11:54
 * @Version 1.0
 */
@Mapper
public interface CommentMapper {
    @Insert("insert into comment(content,created,user_id,weibo_id) values(#{content},#{created},#{userId},#{weiboId})")
    int insertComment(Comment comment);

    @Delete("delete from comment where id=#{id}")
    int deleteComment(Comment comment);


    @Update("update comment set id=#{id},content=#{content} where id=#{id}")
    int updateComment(Comment comment);

    @Select("select content,user_id userId, weibo_id weiboId from comment where id=#{cid}")
    CommentVo1 selectCommentVo1(Long cid);

    @Select("select content,user_id userId from comment where weibo_id=#{weiId}")
    List<CommentVo2> selectCommentVo2(Long weiboId);



}
